<%@page pageEncoding="UTF-8"%>
<%@page import="com.kzw.core.util.AppUtil"%>
<%
response.addHeader("__timeout","true");
String path = request.getContextPath();
String base = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=base%>">
		<title><%=AppUtil.getCompanyName()%></title>
		<link href="css/login/style.css" rel="stylesheet" type="text/css"/>
		<script type="text/javascript">
			var __ctxPath="<%=request.getContextPath() %>";
			var __loginImage=__ctxPath+"<%=AppUtil.getCompanyLogo()%>";
		</script>
		<script type="text/javascript" src="js/core/lib/jquery.min-1.7.1.js"></script>
		
		<script type="text/javascript">
			function submitForm() {
				//判空
				if($('#username').val()=='' || $('#password').val()=='') {
					alert('用户名或密码不能为空');
					$('#password').val('');
					$('#username').focus();
					return;
				}
				var params = {
						username: $('#username').val(),
						password: $('#password').val()
					}
				$.post(__ctxPath + '/login.do', params, function(result) {
						handleLoginResult(result);
					}, 'json');
			}
			function handleLoginResult(result) {
				if (result.success) {
					window.location.href = __ctxPath + '/index.jsp';
				} else {
					alert(result.msg);
				}
			}
			//回车提交
			function enterIn(evt) {
				var evt=evt?evt:(window.event?window.event:null);//兼容IE和FF 
 				if (evt.keyCode==13){ 
  					document.getElementById('imgbt').click();
				} 
			}
		</script>
	
	</head>
<body class="index">

	<div class="div">
		<div class="main">
			<form id="loginAction" name="loginAction" onsubmit="return true;" action="#" method="post">
			<div class="input_sty_a">
					<div class="user user_1">
						<input id="username" name="username" maxlength="50" tabindex="1" type="text" value="请输入用户名" class="sty_a" onfocus="if(this.value==='请输入用户名') {this.value='';}" onblur="if (this.value==='') {this.value='请输入用户名';}">
					</div>
					<div class="user user_2">
						<input id="password" name="password" maxlength="50" tabindex="2" type="password"  class="sty_a"  onkeydown="enterIn(event)">
					</div>
					
					<div class="input_sty_c">
						<strong><ul>
						<li><span class="errorMessage" style="display:none;">用户名不能为空！</span></li>
						</ul></strong>
					</div>				
			</div>
			<input type="button" id="imgbt" value="" class="btn" tabindex="3" onmouseover="this.className='btn_hov';" onmouseout="this.className='btn';" onclick="submitForm()">

			</form>
		</div>
		
	</div>
</body>
</html>
	